<?php
/**
 * Latest Products template
 * @package		Jigoshop
 * @subpackage	yStore
 */
?>
<div id="featured-products">
<h2 class="page-title"><?php _e('TẤT CẢ CÁC SẢN PHẨM', 'ystore'); ?></h2>
<?php
$number = 6;

// Set up query
$query_args = array(
	'showposts'		=> $number,
	'post_type'		=> 'product',
	'post_status'	=> 'publish',
	'meta_key'		=> 'featured',
	'meta_value'	=> 'yes',
	'meta_query'	=> array(
		array(
			'key'		=> 'visibility',
			'value'		=> array('catalog', 'visible'),
			'compare'	=> 'IN',
		),
	)
);

// Run the query
$q = new WP_Query($query_args);
do_action('jigoshop_before_shop_loop');
// If there are products
if($q->have_posts()) : 
	echo '<ul id="jcarousel" class="products clearfix jcarousel-skin-tango">';
	while($q->have_posts()) : $q->the_post();
		// Get new jigoshop_product instance
		$_product = new jigoshop_product(get_the_ID()); ?>
		<li class="product">
		
			<?php do_action('jigoshop_before_shop_loop_item'); ?>
			<a href="<?php the_permalink(); ?>">
				<?php do_action('jigoshop_before_shop_loop_item_title', $post, $_product); ?>
				<strong><?php the_title(); ?></strong>
				<?php do_action('jigoshop_after_shop_loop_item_title', $post, $_product); ?>
			</a>
			<?php do_action('jigoshop_after_shop_loop_item', $post, $_product); ?>
			
		</li>
		
	<?php endwhile;
	echo '</ul>';
	
else :
	echo '<p class="info">'.__('No products found which match your selection.', 'jigoshop').'</p>';
endif;
wp_reset_postdata();
do_action('jigoshop_after_shop_loop'); ?>
</div>